package org.springframework.extend.persistence.repository.config;

import org.springframework.beans.factory.config.ConstructorArgumentValues;
import org.springframework.beans.factory.support.RootBeanDefinition;
import org.springframework.beans.factory.xml.ParserContext;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;

public class AbstractExtendBeanDefinitionParser {

	protected boolean hasNode(NodeList nodeList) {
		if (nodeList != null && nodeList.getLength() > 0) {
			return true;
		}
		return false;
	}

	protected RootBeanDefinition newRootBeanDefinition(Element element, ParserContext context, Class<?> targetClass,
			ConstructorArgumentValues constructValues) {
		RootBeanDefinition resourceDef = new RootBeanDefinition(targetClass, constructValues, null);

		resourceDef.setSource(context.extractSource(element));
		return resourceDef;
	}

	protected RootBeanDefinition newRootBeanDefinition(Element element, ParserContext context, Class<?> targetClass) {
		RootBeanDefinition resourceDef = new RootBeanDefinition(targetClass);
		resourceDef.setSource(context.extractSource(element));
		return resourceDef;
	}

}
